﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 寻找两个正序数组的中位数
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = 5 % 2;
            Console.WriteLine(num);
            Console.ReadLine();
        }
        public double FindMedianSortedArrays(int[] nums1, int[] nums2)
        {
            double numCenter = 0;
            List<int> lists = new List<int>();
            lists = nums1.ToList();
            for (int i = 0; i < nums2.Length; i++)
            {
                lists.Add(nums2[i]);
            }
            lists.Sort();
            Console.WriteLine("长度"+lists.Count);
            for (int i = 0; i < lists.Count; i++)
            {
                Console.WriteLine(lists[i]);
            }
            if (lists.Count > 0)
            {
                int num = lists.Count % 2;
                int i = lists.Count / 2;
                if (num == 0) 
                {
                    numCenter = (lists[i] + lists[i - 1]) / 2f;
                    Console.WriteLine("偶数");
                }
                else
                {
                    numCenter = lists[i];
                    Console.WriteLine("奇数");
                }
            }
            else
            {
                numCenter = 0;
            }
   
            return numCenter;
        }
    }
}
